<?php
/**
* Real Estate Project collection edit
* @author: trungdt
* @since: June 22, 2011
* @version: 1.0
* 
* Change logs
*/

if (!defined("EXPONENT")) exit("");
	$listing = null;
	if (isset($_GET['id'])) {
		$listing = $db->selectObject("duan_collections","id=".intval($_GET['id']));
        if ($listing != null) {
			$loc = unserialize($listing->location_data);
		} 
	}
	
    // this module need administrator permission to manage subjects
	//if (exponent_permissions_check("manage",$loc)) {
    if (exponent_users_isAdmin() || exponent_permissions_check("administrate",$loc) ){
        $form = rsnewsitem::collections_form($listing);
		$form->location($loc);
		$form->meta("action","collection_save");   
				
		$template = new template("duanmodule","_collection_form_edit",$loc);
		$template->assign("is_edit",(isset($listing->id) ? 1 : 0));
		$template->assign("form_html",$form->toHTML());
		$template->output();
	} else {
		echo SITE_403_HTML;
	}

?>
